package com.hsw.t1;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Test {
    public static void main(String[] args) {
        double a=0.01;
        double b=0.05;
        //将两个double类型数据转为BigDecimal对象
        BigDecimal ba = BigDecimal.valueOf(a);
        BigDecimal bb = BigDecimal.valueOf(b);
        //对两个BigDecimal对象进行运算
        BigDecimal divide = ba.divide(bb, 2,RoundingMode.HALF_DOWN);
        //再将结果的对象转为double类型数据
        double rs = divide.doubleValue();
        System.out.println(rs);
    }
}
